#ifndef INC_MAINWINDOW_H
#define INC_MAINWINDOW_H

#include "controller/DiagramMan.h"
#include "controller/ToolMan.h"

#include <QMainWindow>

class UMLObject;
class QTextEdit;

class MainWindow : public QMainWindow
{
	Q_OBJECT;

	public:
		MainWindow(QWidget *parent = NULL);

	public slots:
		void newDiagram();

	private slots:
		void onActiveChanged(DiagramFam* fam);
		void edit(UMLObject*);
		void onTextChanged();

	private:
		QTextEdit* _textEdit; // init-checked

		DiagramMan _dman;

		// Declared after DiagramMan: satisfies destruction order req.
		ToolMan _tman;

		/**
		 * Stores the UMLObject we're currently editing. Should probably be
		 * handled by a subclass of QTextEdit, but ROI would be low.
		 *
		 * Warning: to preserve undo functionality, all modifications must be
		 * made through commands, not directly to this pointer!
		 */
		UMLObject* _editing; // init-checked

		void createMenus();
		void createPalette();
		void createTextEdit();
		void select(UMLObject* object);
};

#endif

